<?php
$adminlevel=$this->session->userdata('level');
?>
<div id="wrapper-content1" align="left">

    <table class="titrepage" width="100%">
        <tr>              
            <td >La liste des admins</td>
            <td align="right">Total | <?php echo $total ?> </td>
        </tr>
    </table>
    <table width="100%" class="list">
        <thead>
            <tr>
                <th>Identifiant</th>
                <th>Nom et prénom</th>
                <th>Statut</th>
                <th>Action</th>
            </tr>
        </thead>
        <?php foreach ($query as $aRow): ?>
            <tr>
                <td><?php echo $aRow['ident']; ?></td>
                <td><?php echo $aRow['nom'].' '. $aRow['prenom'];?></td>
                <td><?php if($aRow['level']==1) echo "Super-admin"; else echo "Admin" ; ?></td>
                <td>
                <?php if($aRow['level']< $adminlevel){?>
                    <a href="<?php echo site_url('SB_admin/delete_admin')."/".$aRow['id']?>" onclick="return confirm('Vous etes sure?')"><img border="0"src="<?php echo base_url();?>assets/admin/images/supprimer.png"/></a>
               <?php } else echo "Aucun droit"?>
                </td>
                </tr>
        <?php endforeach; ?>
                </table>
<?php echo $pagination; ?>
    
    <div class="bajouter" align="center">Ajouter un admin</div>
    <div style="margin:10px 0px 10px 0px;display:none;">
    <?php echo form_open('SB_admin/add_admin') ?>
    <div id="viewactu" align="center">
        <table id="formactu" cellpadding="10px" cellspacing="0">
            <tr> <td>Nom</td> <td><input type="text" name="nom" value="<?php echo set_value('nom'); ?>"/></td> </tr>
            <tr> <td>Prenom</td> <td><input type="text" name="prenom" value="<?php echo set_value('prenom'); ?>"/></td> </tr>
            <tr> <td>Identifiant</td> <td><input type="text" name="ident" value="<?php echo set_value('ident'); ?>"/></td> </tr>
            <tr> <td>Mot de passe</td> <td><input type="password" name="pass"/></td> </tr>
            <tr> <td>Confirmation Mot de passe</td> <td><input type="password" name="confirm_pass"/></td> </tr>
            <tr> <td></td><td align="right"><input type="submit" name="submit" style="border:0; width: 160px;height: 30px;background: url(<?php echo base_url();?>assets/admin/images/ajouter.png);" value=" " alt="submit"/></td> </tr>
        </table>
    </div>
    <?php echo form_close() ?>
</div>
    </div>
<!--END wrapper-content-->
